package cn.jhc.dao.Imp;



import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import javax.sql.DataSource;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import cn.jhc.bean.User;
import cn.jhc.db.MyDbUtils;


public class GetUserName extends MyDbUtils{

	public static boolean getAllUserInfo(DataSource dataSource,String username) throws SQLException {
		
		List<User> list = new ArrayList<User>();
		    String sql = "select * from user where username = ?";
			QueryRunner runner=new QueryRunner(dataSource);
			Object[] params=new Object[]{username};
			list=runner.query(sql,new BeanListHandler< User >(User.class),params);	
			if(list.toString()=="[]"){
				return false;
			}else{
				return true;
			}
		
	
	}
   	

}
